
<?php include './application/views/common/header.php'; ?>
<table width="90%" cellspacing="0" cellpadding="0" border="0" class="user_table" style="width:1000px;margin:50px auto;">
	<tr>
		<td valign="top" class="user_table_td"><?php include './application/views/common/user_left.php'; ?></td>
		<!-- Left End -->
		<td valign="top">

<div class="user_list_title">
  <?php include './application/views/common/user_sub_left.php'; ?>
</div>
<!-- User_List_Title End -->

<div class="user_list_con">

		<div class="user_right_border">
			<p>密码请不要太过于简单。</p>
		</div>

<form id="pwd_form">
<input type="hidden" name="act" value="submit">
		<div class="user_right_border">
			<div class="l">原始密码：</div>
			<div class="c">
				<input type="password" value="" maxlength="20" name="oldpwd"  class="input">
			</div>
		</div>
		
		<div class="user_right_border">
			<div class="l">新密码：</div>
			<div class="c">
				<input type="password" value="" maxlength="20" name="newpwd" id="newpwd"  class="input">
			</div>
		</div>
		
		<div class="user_right_border">
			<div class="l">确认密码：</div>
			<div class="c">
				<input type="password" value="" maxlength="20" name="newpwd2" id="newpwd2"  class="input">
			</div>
		</div>
		
		<div class="user_right_border">
			<div class="l"></div>
			<div class="c">
			<input type="button"  class="little_button"  size="30" value="确认修改" onclick="pwdSubmit();">
			</div>
		</div>
</form>

<script>
function pwdSubmit(){
	var options = {
		url : '/user/pwd.html',
		clearForm :true,
		resetForm :true,
		beforeSubmit:  checkForm,
		dataType: "json",
		type:"post",
		success : function(ret) {
			if(ret.msg==''){
				$('#dialog').dialog({
					modal:true,
					title:'系统提示',
					buttons:{"确定":function(){$(this).dialog("close");}},
					close: function() {
						if(ret.url==''){
							window.location.reload();
						}else{
							location=ret.url;
						}
					}
				}); 
				$("#msg").html("操作成功");
			}else{
				$('#dialog').dialog({
					modal:true,
					title:'系统提示',
					buttons:{"确定":function(){$(this).dialog("close");}}
				}); 
				$("#msg").html(ret.msg);
			}
		}
	};
	$("#pwd_form").ajaxSubmit(options);
	return false;
}

function checkForm(){
	var err = '';
	if($('#oldpwd').val()==''){
		err = '请输入新密码';
	}else if($('#newpwd').val()==''){
		err = '请输入新密码';
	}else if($('#newpwd2').val()==''){
		err = '请重复新密码';
	}else if($('#newpwd').val()!=$('#newpwd2').val()){
		err = '两次密码输入不一致';
	}
	
	if(err==''){
		return true;
	}else{
		$('#dialog').dialog({
			modal:true, //蒙层（弹出会影响页面大小）
			title:'系统提示',
			buttons:{"确定":function(){$(this).dialog("close");}}
		}); 
		$("#msg").html(err);
		return false;
	}
}
</script>


</div>
<!-- User_List_Con End -->
</td>
	</tr>
</table>

<?php include './application/views/common/footer.php'; ?>